<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>初始化不会提升(实例2）</title>
</head>

<body>
    <p id="demo"></p>
    <script>
        var x = 5;  // 初始化 x
        elem = document.getElementById("demo");  // 查找元素 
        elem.innerHTML = "x 为：" + x + "，y 为：" + y;         // 显示 x 和 y
    </script>
</body>

</html>